<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button id="btn">点击变色</button>
    <script>

        function randomNum(m, n) {
            var max, min;
            max = n > m ? n : m;
            min = m < n ? m : n;
            return parseInt(Math.random() * (max - min + 1) + min)
        }
        btn.onclick = function () {
            document.body.style.background = 'rgb(' + randomNum(0, 255) + ',' + randomNum(0, 255) + ',' + randomNum(0, 255) + ')'
        }




    </script>
</body>

</html>